//
//  UIViewController+HLCHook.m
//  TestCrash
//
//  Created by CityDo on 2019/4/19.
//  Copyright © 2019 CityDo. All rights reserved.
//

#import "UIViewController+HLCHook.h"
#import <objc/runtime.h>

@implementation UIViewController (HLCHook)
+ (void)hookUIViewController
{
    Method appearMethod = class_getInstanceMethod([self class], @selector(viewDidAppear:));
    Method hookMethod = class_getInstanceMethod([self class], @selector(hook_ViewDidAppear:));
    method_exchangeImplementations(appearMethod, hookMethod);
}


- (void)hook_ViewDidAppear:(BOOL)animated
{
    NSString *appearDetailInfo = [NSString stringWithFormat:@" %@ - %@", NSStringFromClass([self class]), @"didAppear"];
    NSLog(@"%@", appearDetailInfo);
    [self hook_ViewDidAppear:animated];
}
@end


